package com.web.dao.impl;


import com.entity.Platformactivityrecod;
import com.mapper.PlatformactivityrecodMapper;
import com.page.PageInfo;
import com.web.dao.PlatformactivityrecodDao;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository("PlatformactivityrecodDao")
public class PlatformactivityrecodDaoImpl implements PlatformactivityrecodDao {
    @Resource
    PlatformactivityrecodMapper platformactivityrecodMapper;
    /*
    查询全部
     */
    public List<Platformactivityrecod> getAll() throws Exception {
        return platformactivityrecodMapper.getAll();
    }

    public  Platformactivityrecod selectByPrimaryKey(int parid) throws Exception {
        return platformactivityrecodMapper.selectByPrimaryKey(parid);
    }

    public List<Platformactivityrecod> getPlatformactivityrecodsByPage(PageInfo pageInfo) throws Exception {
      Map<String,Object> map = new HashMap<String,Object>();
      map.put("currPage",pageInfo.getCurrPage());
      map.put("pageSize",pageInfo.getPageSize());

      int itemCount = (int)platformactivityrecodMapper.countByExample(null);
      pageInfo.setItemCount(itemCount);
      return platformactivityrecodMapper.getPlatformactivityrecodsByPage(map);
    }

    public int add(Platformactivityrecod platformactivityrecod) throws Exception {
        return platformactivityrecodMapper.insertSelective(platformactivityrecod);
    }

    public int update(Platformactivityrecod platformactivityrecod) throws Exception {
        return platformactivityrecodMapper.updateByPrimaryKeySelective(platformactivityrecod);
    }
}
